package com.cqw.ftp.controller;

import com.cqw.ftp.service.impl.FtpServiceImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/ftp")
public class FtpController {


    @Resource
    FtpServiceImpl ftpServiceImpl;

    @ResponseBody
    @GetMapping("/getFtpFile")
    public Object downloadFtpFile(String fileName){

        List<String> fileNames = Arrays.asList(fileName);
        boolean resultflag = ftpServiceImpl.downloadFile(fileNames);
        return resultflag ? "ftp文件下载成功" : "ftp文件下载失败";
    }
}
